package com.power.sifa.approve.model.doc;

import cn.hutool.core.util.ObjectUtil;
import com.power.sifa.approve.model.enumeration.Tp_procmaterial;
import lombok.Data;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @ClassName HearAuditHearingDoc
 * @Author xiongzw
 * @Date 2023/11/24 15:22
 * @Description 行政复议听证通知书
 * @Version: 1.0
 **/
@Data
public class HearAuditHearingDoc extends AbstractDoc {

    /**
     * 当事人
     */
    private String party;
    /**
     * 正文
     */
    private String content;
    /**
     * 补充内容
     */
    private String statement;


    public HearAuditHearingDoc() {
        super();
        this.setDocType(Tp_procmaterial.HEAR_HEARING);
    }

    public HearAuditHearingDoc(String applyid) {
        super(applyid);
        this.setDocType(Tp_procmaterial.HEAR_HEARING);
    }

    public HearAuditHearingDoc(String applyid, String party, String content, String statement) {
        super(applyid);
        this.setDocType(Tp_procmaterial.HEAR_HEARING);
        this.party = party;
        this.content = content;
        this.statement = statement;
    }

    private static final String TEMPLATE = "    {apl_admreview_applyname}对{apl_admreview_targetname}[{behavior}]不服提出的行政复议申请，本府依法已予受理。根据《中华人民共和国行政复议法实施条例》第三十三条的规定，本府决定于{today}在（听证详细地址）举行行政复议听证会，请你（们／单位）携带有关证据材料准时参加。无正当事由逾期不参加，视为放弃听证。\n";

    private static final String STATEMENT_TEMPLATE = "    本次听证会主持人：（主持人）、听证员：（听证员）。如认为听证主持人或者听证员存在法律规定中应当回避的情形时，请在听证会开始前提出回避申请，并注明理由。当事人可以委托1至2名代理人参加行政复议听证";

    @Override
    public AbstractDoc generateTemplate(String applyid) {
        HearAuditHearingDoc template = new HearAuditHearingDoc(applyid);
        // 案号
        template.setApl_admre_audit_code(this.getApl_admre_audit_code());
        template.setParty("当事人");
        String content = TEMPLATE.replace("{apl_admreview_applyname}", ObjectUtil.isNotNull(this.getAdmreObj()) ?
                this.getAdmreObj().getApplyname() : "" );
        content = content.replace("{apl_admreview_targetname}", ObjectUtil.isNotNull(this.getAdmreObj()) ?
                this.getAdmreObj().getTargetname() : "" );
        content = content.replace("{behavior}", this.transBehavior());
        SimpleDateFormat formatT = new SimpleDateFormat("yyyy年M月d日H时m分");
        content = content.replace("{today}", formatT.format(new Date()));
        template.setContent(content);
        template.setStatement(STATEMENT_TEMPLATE);
        return template;
    }
}
